from selenium.webdriver.common.by import By

from base.base_action import BaseAction


class HomePage(BaseAction):
    # 特征
    username = By.ID, "u"
    password = By.ID, "p"
    button_label = By.ID, "login_button"
    res_text_label = By.XPATH, '//div[@style="width: 100%; text-align: center; font-size: 16px; font-weight: bold"]'

    # 操作
    def input_user(self, text):
        self.send_keys(self.username, text)

    def input_pw(self, text):
        self.send_keys(self.password, text)

    def click_button(self):
        self.click(self.button_label)

    def res_get_text(self):
        return self.get_text(self.res_text_label)
